import {get,post,upload,postFormData} from './http.js'

/** 获取案件信息 */
export const getCase = id => get('/api/lawsuits/case/getCase/'+id)

/** 创建案件阶段 */
export const createStage = (id,params) => postFormData('/api/lawsuits/case/createStage/'+id,params)

/** 案件排序 */
export const sortStage = (params) => post('/api/lawsuits/case/sortStage',params)

/** 删除案件阶段 */
export const deleteStage = id => post("/api/lawsuits/case/deleteStage/"+ id)


/** 创建任务事项 */
export const createTask = (id,params) => postFormData('/api/lawsuits/case/crateTask/'+id,params)

/** 删除任务事项 */
export const deleteTask = (params) => post('/api/lawsuits/case/deleteTask/'+params)

/** 事项排序 */
export const sortTask = (params) => post('/api/lawsuits/case/sortTask',params)

/** 上传文件 */
export const uploadFile = (caseId,formData) => upload('/api/lawsuits/upload/uploadFile/'+caseId,formData)

/** 保存任务的修改 */
export const saveTask = (caseId,id,params) => post('/api/lawsuits/case/'+caseId+'/updateTask/'+id,params)


/** 获取pdf路径 */
export const getPdf = (id) => get("/api/lawsuits/convert/convertById/"+id)

/** 获取标签 */
export const getLabels = (id) => get("/api/lawsuits/evidence/get/"+id)

/** 识别文字 */
export const recognition = (params) => postFormData('/api/lawsuits/ocr/accurate_basic',params)

/** 保存案件证据 */
export const saveCaseEvidence = (caseId,id,parmas) => post('/api/lawsuits/evidence/save/'+caseId + (id == null ? '' : ('/' + id) ) ,parmas)

/** 删除案件证据 */
export const deleteLabel = (id) => post('/api/lawsuits/evidence/delete/'+id)


/** 获取文件系统 */
export const getFile = (id) => get('/api/lawsuits/case/getFile/' + id)

/** 文件合并 */
export const pdfMarge = (fileName,params,id) =>  post("/api/lawsuits/convert/pdfMarge/"+id+"?fileName="+fileName,params)
export const sendData = (id,params) =>  post("/api/lawsuits/archives/sendData/"+id,params)
export const fileCollect = (fileName,params) =>  post("/api/lawsuits/convert/fileCollect?fileName="+fileName,params)

/** 添加购物车 */
export const saveCart = (id,params) => post("/api/lawsuits/cart/save/"+id,params)

/** 查询购物车 */
export const getCart = (id) => get("/api/lawsuits/cart/get/"+id)

/** 删除购物车文件 */
export const deleteCartFile = (id,did) => post("/api/lawsuits/cart/del/"+id +"/"+did)

/** 购物车文件排序 */
export const sortCartFile = (id,params) => post('/api/lawsuits/cart/sort/'+id, params)


/** 查询评论 */
export const getComment = (id) => get("/api/lawsuits/comment/getComment/"+id)

/** 文件检索 */
export const searchFiles = (caseId,str) => get("/api/lawsuits/search/searchFiles/"+caseId+"?str="+str)